package com.itheima.common;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

public class StatusConverter implements Converter<Integer> {


    @Override
    public WriteCellData<String> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        String statusStr="状态：";
        switch (value) {
            case 1:
                statusStr+= "待付款";
                break;
            case 2:
                statusStr+= "待派送";
                break;
            case 3:
                statusStr+= "已派送";
                break;
            case 4:
                statusStr+= "已完成";
                break;
            case 5:
                statusStr+= "已取消";
                break;
            default:
                statusStr+= "未知";
        }
        return new WriteCellData<>(statusStr);
    }
}
